/****************************************************************
 * Filename: busDemo.h
 * -------------------------------
 * Copyright(C),
 * Author: zhenquan.qiu
 * Version: V1.0.0
 * Last modified: 01/03 2017 12:45
 * Description:
 * 
 * Change Log:
 * NO.	Author		    Date		Modified
 * 00	zhenquan.qiu	01/03 2017
 ****************************************************************/
#ifndef _BUSDEMO_H_
#define _BUSDEMO_H_

#include <linux/device.h>

struct busdemo_device {
    char *name;
    struct device device;
};

#define to_busdemo_device(dev) container_of((dev), struct busdemo_device, device)

struct busdemo_driver {
    char *version;
    struct module *module;
    int (*probe)(struct busdemo_device *);
    int (*remove)(struct busdemo_device *);
    void (*shutdown)(struct busdemo_device *);
    int (*suspend)(struct busdemo_device *, pm_message_t state);
    int (*resume)(struct busdemo_device *);
    struct device_driver driver;
    struct driver_attribute version_attr;
};

#define to_busdemo_driver(drv) container_of((drv), struct busdemo_driver, driver)


extern int register_busdemo_driver(struct busdemo_driver *drv);
extern void unregister_busdemo_driver(struct busdemo_driver *drv);

extern int register_busdemo_device(struct busdemo_device *busdemo_dev);
extern void unregister_busdemo_device(struct busdemo_device *busdemo_dev);

#endif /* _BUSDEMO_H_ */

